package com.es.www.secondWay;

import lombok.Data;
import lombok.ToString;

/**
 * @Created by michangtao
 * @Date 2022/5/16 13:39
 * @Description
 */
@Data
@ToString
public class Product {

    private String hamburger;
    private String fries;
    private String cola;
    private String drumstick;

    public Product() {
    }

    public Product(ProductBuilder productBuilder) {
        this.hamburger = productBuilder.hamburger;
        this.fries = productBuilder.fries;
        this.cola = productBuilder.cola;
        this.drumstick = productBuilder.drumstick;
    }

    static class ProductBuilder extends Builder{

        private String hamburger;
        private String fries;
        private String cola;
        private String drumstick;

        @Override
        protected Builder buildHamburger(String hamburger) {
            this.hamburger = hamburger;
            return this;
        }

        @Override
        protected Builder buildFries(String fries) {
            this.fries = fries;
            return this;
        }

        @Override
        protected Builder buildCola(String cola) {
            this.cola = cola;
            return this;
        }

        @Override
        protected Builder buildDrumstick(String drumstick) {
            this.drumstick =drumstick;
            return this;
        }

        @Override
        protected Product buildProduct() {
            return new Product(this);
        }
    }

}
